#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using pii = pair < int , int >;
using vec = vector < int >;
using veg = vector < pii >;
using ll = long long;
using db = double;
using tl = tuple < int, int, int >;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 1010;

db f[N][N], s[N], ts[N];
int n, m;

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
	n = in, m = in; rep(i, 1, n) f[i][in] = 1;
	rep(i, 1, m) {
		int x = in, y = in;
		rep(j, 1, n) f[x][j] = f[y][j] = (f[x][j] + f[y][j]) / 2;
	}
	db ans = 0;
	rep(i, 1, n) {
		per(j, n, 1) ts[j] = ts[j + 1] + s[j];
		rep(j, 1, n) ans += (ts[j + 1] + 0.5 * s[j]) * f[i][j];
		rep(j, 1, n) s[j] += f[i][j];
	} printf("%.8lf\n", ans); return 0;
}
